package net.zjitc.utils;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/11/8.
 */
public class ControllerUtils {
    public static List<Class> getClassAll(String packName) throws ClassNotFoundException {
        List<Class>  list=new ArrayList();
        String packPath=packName.replace(".","/");
        URL url=Thread.currentThread().getContextClassLoader().getResource(packPath);
        File file=new File(url.getPath());
        File[] files = file.listFiles();
        for (File f :
                files) {
            String className=packName+"."+f.getName();
            className=className.substring(0,className.length()-6);
            Class clazz=Class.forName(className);
            list.add(clazz);
        }
        return list;
    }
}
